#
# Created by gmakemake (Sparc Jul 27 2.15) on Fri Mar 12 14:28:13 2010
#

#
# Definitions
#

.SUFFIXES:
.SUFFIXES:	.a .o .c .C .cpp
.c.o:
		$(COMPILE.c) $<
.C.o:
		$(COMPILE.cc) $<
.cpp.o:
		$(COMPILE.cc) $<
.c.a:
		$(COMPILE.c) -o $% $<
		$(AR) $(ARFLAGS) $@ $%
		$(RM) $%
.C.a:
		$(COMPILE.cc) -o $% $<
		$(AR) $(ARFLAGS) $@ $%
		$(RM) $%
.cpp.a:
		$(COMPILE.cc) -o $% $<
		$(AR) $(ARFLAGS) $@ $%
		$(RM) $%

CC =		gcc
CXX =		g++

RM = rm -f
AR = ar
LINK.c = $(CC) $(CFLAGS) $(CPPFLAGS) $(LDFLAGS)
LINK.cc = $(CXX) $(CXXFLAGS) $(CPPFLAGS) $(LDFLAGS)
COMPILE.c = $(CC) $(CFLAGS) $(CPPFLAGS) -c
COMPILE.cc = $(CXX) $(CXXFLAGS) $(CPPFLAGS) -c

#
# This header.mak file will set up all necessary options for compiling and
# linking C and C++ programs that use Player and Stage
#
# To use the Sun C or C++ compiler, you will need to add one of the following
# lines:
#
#	CC = cc
#	CCC = cc
#
# Also, if you want to take advantage of GDB's extra debugging features, change
# "-g" in the CFLAGS and LIBFLAGS macro definitions to "-ggdb"
#

CC = gcc
CXX = g++

OWINC=/usr/openwin/include
OWLIB=/usr/openwin/lib
GLUTINC=/usr/local/glut/include
GLUTLIB=/usr/local/glut/lib/glut

LDLIBS = -lglut -lGLU -lGL -lXext -lX11 -lm

PLAYER_VERSION = `if [ -d "/usr/local/include/player-2.1" ]; then echo "2.1"; else echo "2.0"; fi`

CFLAGS = -I$(GLUTINC) -I$(OWINC) -I/usr/local/include/player-$(PLAYER_VERSION) -I/usr/local/include -I/usr/local/playerstage/include -I/usr/local/playerstage/include/player-$(PLAYER_VERSION)
CLIBFLAGS = -ggdb -L$(GLUTLIB) -L$(OWLIB) $(LDLIBS) -L/opt/csw/lib -L/usr/local/lib -lplayerc -lm -lplayerxdr -lplayererror -lXmu
CXXFLAGS = -Wall -I$(GLUTINC) -I$(OWINC) -I/usr/local/include/player-$(PLAYER_VERSION) -I/usr/local/include -I/usr/local/playerstage/include/player-$(PLAYER_VERSION)
CCLIBFLAGS = -ggdb -L$(GLUTLIB) -L$(OWLIB) $(LDLIBS) -L/opt/csw/lib -L/usr/local/lib -lplayerc++ -lplayerc -lm -lplayerxdr -lplayererror -lXmu


########## End of flags from header.mak


CPP_FILES =	 AStar.cpp Grid.cpp retriever.cpp
C_FILES =	
H_FILES =	AStar.h Grid.h 
SOURCEFILES =	$(H_FILES) $(CPP_FILES) $(C_FILES)
.PRECIOUS:	$(SOURCEFILES)
OBJFILES =	AStar.o Grid.o 

#
# Main targets
#

all:	 retriever

retriever:	retriever.o $(OBJFILES)
	$(CXX) $(CXXFLAGS) -o retriever retriever.o $(OBJFILES) $(CCLIBFLAGS)

#
# Dependencies
#

AStar.o:	AStar.cpp
Grid.o:	Grid.cpp
retriever.o:	AStar.cpp Grid.cpp 

#
# Housekeeping
#

Archive:	archive.tgz

archive.tgz:	$(SOURCEFILES) Makefile
	tar cf - $(SOURCEFILES) Makefile | gzip > archive.tgz

clean:
	-/bin/rm -r $(OBJFILES) retriever.o core 2> /dev/null

realclean:        clean
	/bin/rm -rf  retriever
